package produceconsumer2;

import java.util.LinkedList;


public class Test {
    public static void main(String[] args) throws Exception{

        Object lock = new Object();
        LinkedList<String> linkedList = new LinkedList<>();

        Thread t1 = new Thread(()->{
            Producer producer = new Producer(linkedList,lock);
            try {
                producer.createProduct();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });

        Thread t3 = new Thread(()->{
            Producer producer = new Producer(linkedList,lock);
            try {
                producer.createProduct();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });

        Thread t2 = new Thread(()->{
            Consumer consumer = new Consumer(linkedList,lock);
            try {
                consumer.consumeProduct();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });

        t1.start();
        t2.start();
        t3.start();

    }
}
